﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace VoteSystem.Filters
{
    public class SessionFilterAttribute : System.Web.Mvc.ActionFilterAttribute
    {
        public override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            if (filterContext.HttpContext.Session["loginUser"] == null)
            {
                var viewResult = new ViewResult();
                viewResult.ViewName = "SessionOut";
                filterContext.Result = viewResult;
            
            }
        }
    }
}